package com.egg.mall.service.sku.order;

import com.egg.common.mybatis.service.IBaseService;
import com.egg.mall.entity.sku.orders.SkuOrdersLinkSkuSnapshot;
import com.egg.mall.entity.sku.Sku;
import com.egg.mall.model.request.OrderPostOrPut;

import java.io.Serializable;
import java.util.List;


/**
 * @author east
 * @since 2022-08-27
 */
public interface ISkuOrdersLinkSkuSnapshotService extends IBaseService<SkuOrdersLinkSkuSnapshot> {


    /**
     * sku 转为 orderSku
     *
     * @param sku
     * @param quantity
     * @return orderSku
     */
    SkuOrdersLinkSkuSnapshot convertOrderSku(Sku sku, Integer quantity);

    /**
     * 构建订单明细
     * -- 修改库存
     *
     * @param sourceList
     * @return
     */
    List<SkuOrdersLinkSkuSnapshot> buildOrderSku(long sourcePayAmount, List<OrderPostOrPut.Sku> sourceList);

    List<SkuOrdersLinkSkuSnapshot> findByOrderId(Serializable orderId);

    /**
     * 还原库存
     *
     * @param orderId
     */
    void resumeSkuStockByOrderId(Serializable orderId);


}
